﻿#!/usr/bin/python
# -*- coding:UTF-8 -*-
# 功能: 清除目录下的空文件夹 ignore中的文件夹会跳过
import os

ignore = ['movie']

def empty(dir):
    for root, dirs, files in os.walk(dir):
   		if(len(dirs) + len(files)==0):
   			return True;
   		else:
   			return False;

def emptyDirClear(dirname):
	for root,dirs,files in os.walk(dirname):
		for dir in dirs:
			if dir in ignore:
				continue
			src = os.path.join(root,dir)
			if(empty(src)):
				os.rmdir(src)

if __name__ == '__main__':
	emptyDirClear('.')